package animation.wlh.com.animation_demo.basic

import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.view.animation.AnimationSet
import android.view.animation.RotateAnimation
import android.view.animation.ScaleAnimation
import animation.wlh.com.animation_demo.R
import kotlinx.android.synthetic.main.activity_alpha_anim.*

/**
 * Created by weilh on 2016/1/22.
 */
class AnimationSetAct: AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_anim_set)
        title = "动画集合"
        view.setOnClickListener{
            var animSet = AnimationSet(true)
            var scaleAnim = ScaleAnimation(0f,1f,0f,1f, view.width / 2f, view.height / 2f)
            scaleAnim.duration = 2000
            animSet.addAnimation(scaleAnim)

            var rotateAnim = RotateAnimation(0f, 360f, view.width / 2f, view.height / 2f)
            rotateAnim.duration = 2000;
            animSet.addAnimation(rotateAnim)

            view.startAnimation(animSet)
        }
    }
}
